<?php
   if(isset($query)){
       if($query->num_rows > 0){
           $content_data = $query->row();
  
       }
   }
?>

<div id=content_wrapper>
    <h1>information</h1>
    <img src="<?php echo base_url().'/assets/thumbs/'.$content_data->image?>"></img>
    <p>First name :<?php echo $content_data->name; ?></p>
    <p>Last name :<?php echo $content_data->prename; ?></p>
    <p>Birthday :<?php echo $content_data->birthday; ?></p>
    <p>Death :<?php echo $content_data->death; ?> </p>  
    <p>Address :<?php echo $content_data->address; ?></p>
 
</div>

<div id=content_description>
    <?php echo $content_data->description; ?>
</div><!--End #content_description-->

<div id="commentContent">
    <?php 
        if(isset($comment_content) && ($comment_content != NULL)){
            foreach($comment_content as $comment_data){
            ?>
            <div id="commentAuthor">
            <p>Commented by :<span class="userComment"><?php echo $comment_data['user_name'];?></span></p>
            <p>date :<span class="userComment"><?php echo $comment_data['date_comment'];?></span></p>
            
            <p class="comment"><?php echo $comment_data['comment'] ?></p>
            </div>
            
            <?php    
            }
        }
    ?>
    
</div>

<div id=comment_form_content>
<?php 
$userid = $this->session->userdata('userid');
if($userid!=NULL && (isset($userid))){
    
?>
    <div id="form_comment_content">
        <fieldset>
            <legend>Comment</legend>
            <p>After comment, your comment will be checked before posted !</p>
            <form id="commentForm" name="commentForm" action="<?php echo site_url('home/add_comment_content').'/'.$content_data->id_content ?>" method="post">
            <?php echo form_error('comment');?>
            <textarea id="comment" name="comment" cols="40" rows="2">

            </textarea>
            <input type="submit" id="postComment" name="postComment" value="Comment"/>
            </form>
        </fieldset>
    </div>
</div><!--End #comment_form_content-->
<div>
<?php } else {
    echo "<p>You must login to comment</p>";
}?>
</div>